package org.example.controller;

import org.example.entity.Air;
import org.example.service.IAirService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/airs")
public class AirController {
    @Autowired
    private IAirService airService;

    @GetMapping
    public List<Air> getAll(){
        return airService.getAll();
    }

    @GetMapping("/{id}")
    public Air get(@PathVariable Long id){
        return airService.get(id);
    }

    @PostMapping
    public int add(@RequestBody Air air){
        return airService.add(air);
    }

    @PutMapping
    public int update(@RequestBody Air air){
        return airService.update(air);
    }

    @DeleteMapping("/{id}")
    public int del(@PathVariable Long id){
        return airService.del(id);
    }

}
